﻿/****************************************************************************
*                                                                           *
* Hipocrate.NET - Presentation Page                                         *
* Copyright (c) RSC. All rights reserved(2010).								*
* Developer: Marius Ionescu    						                        *
*                                                                           *
****************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using NS_Controls;
using System.Collections;
using AjaxControlToolkit;
using System.Drawing;
using System.Web.UI.HtmlControls;
using System.Web.Services;
using System.Web.Script.Services;

public partial class Presentation : SessionControlBase, ICallbackEventHandler
{
    public string pacientID
    {
        get { return (string)(this.ViewState["pacientID"] ?? ""); }
        set { this.ViewState["pacientID"] = value; }
    }

    public string presentationID
    {
        get { return (string)(this.ViewState["presentationID"] ?? ""); }
        set { this.ViewState["presentationID"] = value; }
    }

    public string strMessage
    {
        get { return (string)(this.ViewState["strMessage"] ?? ""); }
        set { this.ViewState["strMessage"] = value; }
    }

    public void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                historyPresentation.Style.Add("display", "none");
                pacientID = (Request.QueryString["pacientID"] ?? "").ToString();
                if (Request.QueryString["presentationID"] != null)
                    presentationID = Request.QueryString["presentationID"].ToString();
                LoadData();
            }

            btnClose.OnClick = "$get('" + CancelButton1.ClientID + "').click();";
            btnCloseSpec.OnClick = "$get('" + CancelButtonSpec.ClientID + "').click();";
        }
        catch (Exception ex)
        {
            this.SetMessage(string.Format("[@'{0}'] {1}", this.ID, ex.Message), true);
        }
    }

    #region ICallbackEventHandler Members

    public string GetCallbackResult()
    {
        return strMessage;
    }

    public void RaiseCallbackEvent(String eventArgument)
    {
        mdlPopup.Hide();
        strMessage = eventArgument;
    }

    #endregion

    [WebMethod, ScriptMethod]
    static public string SendMessage(string msg)
    {
        try
        {

        }
        catch (Exception ex)
        {
            //SessionPageBase.SetMessageStatic(ex.Message, true);
        }
        return "";
    }

    public void LoadData()
    {
        try
        {
            if (pacientID.Length == 0) return;
            DataSet ds_Presentation = Hipocrate.DB.DBConnection.GetData("Select_Presentations", new string[] { "pacientID" }, new object[] { this.pacientID });
            DataView dv0 = ds_Presentation.Tables[0].DefaultView;
            DataView dv1 = ds_Presentation.Tables[2].DefaultView;
            DataView dv2 = ds_Presentation.Tables[3].DefaultView;
            DataView dv3 = ds_Presentation.Tables[4].DefaultView;
            DataView dv4 = ds_Presentation.Tables[5].DefaultView;
            DataView dv5 = ds_Presentation.Tables[6].DefaultView;
            DataView dv6 = ds_Presentation.Tables[7].DefaultView;
            DataView dv7 = ds_Presentation.Tables[8].DefaultView;
            DataView dv8 = ds_Presentation.Tables[9].DefaultView;
            DataView dv9 = ds_Presentation.Tables[10].DefaultView;
            DataView dv10 = ds_Presentation.Tables[11].DefaultView;
            DataView dv11 = ds_Presentation.Tables[12].DefaultView;
            DataView dv12 = ds_Presentation.Tables[13].DefaultView;
            DataView dv13 = ds_Presentation.Tables[14].DefaultView;
            DataView dv14 = ds_Presentation.Tables[15].DefaultView;
            DataView dv15 = ds_Presentation.Tables[16].DefaultView;

            resultsPresentations.DataSource = dv0;
            resultsPresentations.DataBind();

            statutDrp.DataSource = dv1;
            statutDrp.DataTextField = "Name";
            statutDrp.DataValueField = "ID";
            statutDrp.DataBind();
            statutDrp.Items.Insert(0, "");

            asiguratDrp.DataSource = dv2;
            asiguratDrp.DataTextField = "Name";
            asiguratDrp.DataValueField = "ID";
            asiguratDrp.DataBind();
            asiguratDrp.Items.Insert(0, "");

            tipAsiguratDrp.DataSource = dv3;
            tipAsiguratDrp.DataTextField = "Name";
            tipAsiguratDrp.DataValueField = "ID";
            tipAsiguratDrp.DataBind();
            tipAsiguratDrp.Items.Insert(0, "");

            tipAsigurareDrp.DataSource = dv4;
            tipAsigurareDrp.DataTextField = "Name";
            tipAsigurareDrp.DataValueField = "ID";
            tipAsigurareDrp.DataBind();
            tipAsigurareDrp.Items.Insert(0, "");

            catAsiguareDrp.DataSource = dv5;
            catAsiguareDrp.DataTextField = "Name";
            catAsiguareDrp.DataValueField = "ID";
            catAsiguareDrp.DataBind();
            catAsiguareDrp.Items.Insert(0, "");

            levelStudiesDrp.DataSource = dv6;
            levelStudiesDrp.DataTextField = "Name";
            levelStudiesDrp.DataValueField = "ID";
            levelStudiesDrp.DataBind();
            levelStudiesDrp.Items.Insert(0, "");

            ocupationDrp.DataSource = dv7;
            ocupationDrp.DataTextField = "Description";
            ocupationDrp.DataValueField = "ID";
            ocupationDrp.DataBind();
            ocupationDrp.Items.Insert(0, "");

            citizenshipTypeDrp.DataSource = dv8;
            citizenshipTypeDrp.DataTextField = "Name";
            citizenshipTypeDrp.DataValueField = "ID";
            citizenshipTypeDrp.DataBind();
            citizenshipTypeDrp.Items.Insert(0, "");

            citizenshipDrp.DataSource = dv9;
            citizenshipDrp.DataTextField = "Name";
            citizenshipDrp.DataValueField = "ID";
            citizenshipDrp.DataBind();
            citizenshipDrp.Items.Insert(0, "");

            drpSection.DataSource = dv10;
            drpSection.DataTextField = "name";
            drpSection.DataValueField = "code";
            drpSection.DataBind();
            drpSection.Items.Insert(0, "");

            drpMedic.Items.Insert(0, "SELECTATI SECTIA");

            drpTipVenire.DataSource = dv11;
            drpTipVenire.DataTextField = "description";
            drpTipVenire.DataValueField = "id";
            drpTipVenire.DataBind();
            drpTipVenire.Items.Insert(0, "");

            drpTipTrimitere.DataSource = dv12;
            drpTipTrimitere.DataTextField = "description";
            drpTipTrimitere.DataValueField = "id";
            drpTipTrimitere.DataBind();
            drpTipTrimitere.Items.Insert(0, "");

            rptMedic.DataSource = dv13;
            rptMedic.DataBind();

            rptSpec.DataSource = dv14;
            rptSpec.DataBind();

            lblPacient.Text = dv15[0]["FirstName"].ToString() + " " + dv15[0]["LastName"].ToString();
            lblCNP.Text = dv15[0]["CNP"].ToString();
            lblBirthNDate.Text = dv15[0]["BirthNDate"].ToString();
            lblProfession.Text = dv15[0]["ProfessionName"].ToString();
            lblUnitate.Text = dv15[0]["WorkPlace"].ToString();
            lblPhone.Text = dv15[0]["Phone"].ToString();
            lblGrSang.Text = dv15[0]["GrSang"].ToString();
            lblAlergies.Text = dv15[0]["Alergies"].ToString();

            if (!string.IsNullOrEmpty(presentationID))
            {
                LoadDataPresentationID(null, null);
            }

           
        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    protected void resultsPresentations_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView data = e.Item.DataItem as DataRowView;
        if (data != null)
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
                ((LinkButton)e.Item.FindControl("presentation")).CommandArgument = data["PresentationID"].ToString();
    }

    public void LoadDataPresentationID(object sender, EventArgs e)
    {
        try
        {
            if (sender is LinkButton)
            {
                presentationID = (sender as LinkButton).CommandArgument;
            }

            TabbedDetails.ShowUrl(this, "action", TabbedDetails.action[TabbedDetails.admissionTabIndex],
                "pacientID", pacientID, "presentationID", presentationID);

            HighlightPresentation();

            DataSet ds = Hipocrate.DB.DBConnection.GetData("Select_Presentations", new string[] { "presentationID" }, new object[] { presentationID });
            DataView dv0 = ds.Tables[1].DefaultView;
            DataView dv16 = ds.Tables[17].DefaultView;
            DataView dv17= ds.Tables[18].DefaultView;

            trPresData.Visible = true;
            trInfAsig.Visible = true;
            trInfVenire.Visible = true;
            trDateTrimitere.Visible = true;
            trExaminare.Visible = true;
            trInformationSupliment.Visible = true;

            if (dv16.Count > 0)
            {
                if (dv16[0]["InsurerChartID"] != System.DBNull.Value)
                    statutDrp.SelectedValue = dv16[0]["InsurerChartID"].ToString();
                else
                    statutDrp.SelectedIndex = 0;

                if (dv16[0]["InsurerID"] != System.DBNull.Value)
                    asiguratDrp.SelectedValue = dv16[0]["InsurerID"].ToString();
                else
                    asiguratDrp.SelectedIndex = 0;

                if (dv16[0]["InsurerTypeID"] != System.DBNull.Value)
                    tipAsiguratDrp.SelectedValue = dv16[0]["InsurerTypeID"].ToString();
                else
                    tipAsiguratDrp.SelectedIndex = 0;

                if (dv16[0]["PersType"] != System.DBNull.Value)
                    tipAsigurareDrp.SelectedValue = dv16[0]["PersType"].ToString();
                else
                    tipAsigurareDrp.SelectedIndex = 0;

                if (dv16[0]["InsurerCategID"] != System.DBNull.Value)
                    catAsiguareDrp.SelectedValue = dv16[0]["InsurerCategID"].ToString();
                else
                    catAsiguareDrp.SelectedIndex = 0;

                if (dv16[0]["InsuranceNo"] != System.DBNull.Value)
                    txtNrAsig.Text = dv16[0]["InsuranceNo"].ToString();
                else
                    txtNrAsig.Text = "";

                if (dv16[0]["PacientStudiesID"] != System.DBNull.Value)
                    levelStudiesDrp.SelectedValue = dv16[0]["PacientStudiesID"].ToString();
                else
                    levelStudiesDrp.SelectedIndex = 0;

                if (dv16[0]["ProfessionID"] != System.DBNull.Value)
                    ocupationDrp.SelectedValue = dv16[0]["ProfessionID"].ToString();
                else
                    ocupationDrp.SelectedIndex = 0;

                if (dv16[0]["CitizenshipTypeID"] != System.DBNull.Value)
                    citizenshipTypeDrp.SelectedValue = dv16[0]["CitizenshipTypeID"].ToString();
                else
                    citizenshipTypeDrp.SelectedIndex = 0;

                if (dv16[0]["CitizenshipID"] != System.DBNull.Value)
                    citizenshipDrp.SelectedValue = dv16[0]["CitizenshipID"].ToString();
                else
                    citizenshipDrp.SelectedIndex = 0;

                if (dv16[0]["RefID"] != System.DBNull.Value)
                    txtNrRegistru.Text = dv16[0]["RefID"].ToString();
                else
                    txtNrRegistru.Text = "";

                if (dv16[0]["IsInitial"] != System.DBNull.Value)
                    chkConsult.Checked = Convert.ToBoolean(dv16[0]["IsInitial"]);
                else
                    chkConsult.Checked = false;

                if (dv16[0]["SectionID"] != System.DBNull.Value)
                {
                    foreach (ListItem li in drpSection.Items)
                    {
                        if (0 == String.Compare(li.Value, dv16[0]["SectionID"].ToString()))
                            drpSection.SelectedValue = li.Value;
                    }
                }
                else
                    drpSection.SelectedValue = dv16[0]["SectionID"].ToString();

                if (dv16[0]["DoctorID"] != System.DBNull.Value)
                {
                    DataSet ds_Medic = Hipocrate.DB.DBConnection.GetData("Select_MedicPresentation", new string[] { "@sectionCode", "@medicID" }, new object[] { drpSection.SelectedValue, dv16[0]["DoctorID"].ToString() });
                    DataView dv1 = ds_Medic.Tables[0].DefaultView;
                    DataView dv2 = ds_Medic.Tables[1].DefaultView;

                    if (dv1.Count > 0)
                    {
                        drpMedic.DataSource = dv1;
                        drpMedic.DataTextField = "fullname";
                        drpMedic.DataValueField = "sectioncode";
                        drpMedic.DataBind();

                        if (dv2.Count > 0)
                        {
                            foreach (ListItem li in drpMedic.Items)
                            {
                                if (0 == String.Compare(li.Text, dv2[0]["fullname"].ToString()))
                                    drpMedic.SelectedItem.Text = li.Text;
                            }

                            if (drpMedic.SelectedItem.Text != dv2[0]["fullname"].ToString())
                            {
                                drpMedic.Items.Insert(0, "SELECTATI MEDICUL");
                                drpMedic.SelectedIndex = 0;
                            }
                        }
                        else
                            drpMedic.Items.Insert(0, "SELECTATI MEDICUL");
                    }
                    else
                    {
                        drpMedic.Items.Clear();
                        drpMedic.Items.Insert(0, "SELECTATI SECTIA");
                    }
                }

                if (dv16[0]["DDate"] != System.DBNull.Value)
                    txtDate.Text = dv16[0]["DDate"].ToString();
                else
                    txtDate.Text = "";

                if (dv16[0]["DTime"] != System.DBNull.Value)
                    txtTime.Text = dv16[0]["DTime"].ToString();
                else
                    txtTime.Text = "";

                if (dv16[0]["Emergency"] != System.DBNull.Value)
                    chkUrgenta.Checked = Convert.ToBoolean(dv16[0]["Emergency"]);
                else
                    chkUrgenta.Checked = false;

                if (dv16[0]["TransportTypeID"] != System.DBNull.Value)
                    drpTipVenire.SelectedValue = dv16[0]["TransportTypeID"].ToString();
                else
                    drpTipVenire.SelectedIndex = 0;

                if (dv16[0]["TransportDoctor"] != System.DBNull.Value)
                    txtMedicAmb.Text = dv16[0]["TransportDoctor"].ToString();
                else
                    txtMedicAmb.Text = "";

                if (dv16[0]["TransportFile"] != System.DBNull.Value)
                    txtFisaAmb.Text = dv16[0]["TransportFile"].ToString();
                else
                    txtFisaAmb.Text = "";

                if (dv16[0]["PresReason"] != System.DBNull.Value)
                    txtMotivPrez.Text = dv16[0]["PresReason"].ToString();
                else
                    txtMotivPrez.Text = "";

                if (dv16[0]["PresObs"] != System.DBNull.Value)
                    txtAlteObsv.Text = dv16[0]["PresObs"].ToString();
                else
                    txtAlteObsv.Text = "";

                if (dv16[0]["ChangedUser"] != System.DBNull.Value)
                    lblInreg.Text = dv16[0]["ChangedUser"].ToString();
                else
                    lblInreg.Text = "";

                if (dv16[0]["sChangedDate"] != System.DBNull.Value)
                    lblActualizare.Text = dv16[0]["sChangedDate"].ToString();
                else
                    lblActualizare.Text = "";

                if (dv16[0]["SenderTypeID"] != System.DBNull.Value)
                    drpTipTrimitere.SelectedValue = dv16[0]["SenderTypeID"].ToString();
                else
                    drpTipTrimitere.SelectedIndex = 0;

                if (dv16[0]["SenderSerie"] != System.DBNull.Value)
                    txtBiletTrimitere.Text = dv16[0]["SenderSerie"].ToString();
                else
                    txtBiletTrimitere.Text = "";

                if (dv16[0]["SenderTicket"] != System.DBNull.Value)
                    txtNrBilet.Text = dv16[0]["SenderTicket"].ToString();
                else
                    txtNrBilet.Text = "";

                if (dv16[0]["SenderDate"] != System.DBNull.Value)
                    txtDataBilet.Text = dv16[0]["SenderDate"].ToString();
                else
                    txtDataBilet.Text = "";

                if (dv16[0]["SenderName"] != System.DBNull.Value)
                    txtParafa.Text = dv16[0]["SenderName"].ToString();
                else
                    txtParafa.Text = "";

                if (dv16[0]["SenderContract"] != System.DBNull.Value)
                    txtContract.Text = dv16[0]["SenderContract"].ToString();
                else
                    txtContract.Text = "";

                if (dv16[0]["SenderSpecName"] != System.DBNull.Value)
                    txtSpecialitate.Text = dv16[0]["SenderSpecName"].ToString();
                else
                    txtSpecialitate.Text = "";
            }
            else
            {
                statutDrp.SelectedValue = "";
                asiguratDrp.SelectedValue = "";
                tipAsiguratDrp.SelectedValue = "";
                tipAsigurareDrp.SelectedValue = "";
                catAsiguareDrp.SelectedValue = "";
                txtNrAsig.Text = "";
                levelStudiesDrp.SelectedValue = "";
                ocupationDrp.SelectedValue = "";
                citizenshipTypeDrp.SelectedValue = "";
                citizenshipDrp.SelectedValue = "";
                txtNrRegistru.Text = "";
                chkConsult.Checked = false;
                drpSection.SelectedValue = "";
                drpMedic.SelectedValue = "";
                txtDate.Text = "";
                txtTime.Text = "";
                chkUrgenta.Checked = false;
                drpTipVenire.SelectedValue = "";
                txtMedicAmb.Text = "";
                txtFisaAmb.Text = "";
                txtMotivPrez.Text = "";
                txtAlteObsv.Text = "";
                lblInreg.Text = "";
                lblActualizare.Text = "";
                drpTipTrimitere.SelectedValue = "";
                txtBiletTrimitere.Text = "";
                txtNrBilet.Text = "";
                txtDataBilet.Text = "";
                txtParafa.Text = "";
                txtContract.Text = "";
                txtSpecialitate.Text = "";
            }

            if (statutDrp.SelectedIndex.Equals(4))
            {
                tipAsiguratDrp.Enabled = false;
                catAsiguareDrp.Enabled = false;
            }
            else
            {
                tipAsiguratDrp.Enabled = true;
                catAsiguareDrp.Enabled = true;
            }

            if (citizenshipTypeDrp.SelectedIndex.Equals(0) || citizenshipTypeDrp.SelectedIndex.Equals(1))
            {
                citizenshipDrp.Enabled = false;
                citizenshipDrp.SelectedValue = "";
            }
            else
                citizenshipDrp.Enabled = true;

            rptCheckins.DataSource = dv17;
            rptCheckins.DataBind();
        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    private string highlightStyle = "background-color:LightGreen";
    protected void HighlightPresentation()
    {
        if (presentationID.Length == 0)
            return;
        foreach (RepeaterItem item in resultsPresentations.Items)
        {
            HtmlTableRow row = item.FindControl("firstRow") as HtmlTableRow;
            bool flag = presentationID.Equals((item.FindControl("presentation") as LinkButton).CommandArgument);
            if (flag) row.Attributes.Add("style", highlightStyle); else row.Style.Clear();
            row = item.FindControl("secondRow") as HtmlTableRow;
            if (flag) row.Attributes.Add("style", highlightStyle); else row.Style.Clear();
        }
    }

    protected void onIndex_Changed(Object sender, EventArgs e)
    {
        if (citizenshipTypeDrp.SelectedIndex.Equals(0) || citizenshipTypeDrp.SelectedIndex.Equals(1))
            citizenshipDrp.Enabled = false;
        else
            citizenshipDrp.Enabled = true;
    }

    protected void onStatutIndex_Changed(Object sender, EventArgs e)
    {
        if (statutDrp.SelectedIndex.Equals(4))
        {
            tipAsiguratDrp.Enabled = false;
            catAsiguareDrp.Enabled = false;
        }
        else
        {
            tipAsiguratDrp.Enabled = true;
            catAsiguareDrp.Enabled = true;
        }
    }

    protected void onSection_Changed(Object sender, EventArgs e)
    {
        DataSet ds = Hipocrate.DB.DBConnection.GetData("Select_MedicPresentation", new string[] { "@sectionCode" }, new object[] { drpSection.SelectedItem.Value });
        DataView dv0 = ds.Tables[0].DefaultView;

        if (dv0.Count > 0)
        {
            drpMedic.DataSource = dv0;
            drpMedic.DataTextField = "fullname";
            drpMedic.DataValueField = "sectioncode";
            drpMedic.DataBind();

            drpMedic.Items.Insert(0, "SELECTATI MEDICUL");
        }
        else
        {
            drpMedic.Items.Clear();
            drpMedic.Items.Insert(0, "SELECTATI MEDICUL");
        }
    }

    protected void openPopup_Click(object sender, EventArgs e)
    {
        try
        {
            txtSearchMedic.Text = "";
            mdlPopup.Y = 500;
            mdlPopup.Show();
        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    protected void openPopupSpec_Click(object sender, EventArgs e)
    {
        try
        {
            txtSpecialitate.Text = "";
            mdlPopupSpec.Y = 500;
            mdlPopupSpec.Show();
        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    protected void btnSearch_Click(object sender, EventArgs e)
    {
        DataSet ds = Hipocrate.DB.DBConnection.GetData("Search_Parafa", new string[] { "name" }, new object[] { txtSearchMedic.Text });
        DataView dv0 = ds.Tables[0].DefaultView;

        rptMedic.DataSource = dv0;
        rptMedic.DataBind();

        mdlPopup.Show();
    }

    protected void btnSearchSpec_Click(object sender, EventArgs e)
    {
        DataSet ds = Hipocrate.DB.DBConnection.GetData("Search_Specialitati", new string[] { "name" }, new object[] { txtSpec.Text });
        DataView dv0 = ds.Tables[0].DefaultView;

        rptSpec.DataSource = dv0;
        rptSpec.DataBind();

        mdlPopupSpec.Show();
    }

    protected void detaliiPacient_Click(object sender, EventArgs e)
    {
        LinkButton b = sender as LinkButton;
        System.Web.UI.Control c = this.Parent;
        while ((c != null) && !(c is TabContainer))
            c = c.Parent;
        TabContainer container = c as TabContainer;
        if (container == null)
            return;

        container.ActiveTabIndex = TabbedDetails.pacientTabIndex;
    }

    protected void LoadCheckinID_Click(object sender, EventArgs e)
    {
        try
        {
            LinkButton b = sender as LinkButton;
            string targetId = b.CommandArgument.Substring(2);
            System.Web.UI.Control c = this.Parent;
            while ((c != null) && !(c is TabContainer))
                c = c.Parent;
            TabContainer container = c as TabContainer;
            if (container == null)
                return;

            //this.ViewState["checkinID"] = targetId;
            //CheckIn p = container.Tabs[TabbedDetails.checkinTabIndex].Controls[0].FindControl("checkInPacient") as CheckIn;
            //p.pacientID = this.pacientID;
            //p.checkinID = targetId;
            //p.LoadData();
            //TabbedDetails.SetUrl(this, Request.Path + "?action=checkin&pacientID=" + pacientID + "&checkinID=" + targetId); //if (!~) SetMessage("Not found!", false);
            //container.ActiveTabIndex = TabbedDetails.checkinTabIndex;
        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    protected void btnSearchPage_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Default.aspx?action=search");
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet ds = Hipocrate.DB.DBConnection.GetData("Presentation_Save", 
                new string[] { 
                    "intCodeID", "strRefID", "strPacID", 
                    "strDate", "strSectionID", "strDoctorID", 
                    "UserID", "UserLogin"}, 
                new object[] { 
                    presentationID, txtNrRegistru.Text, pacientID,  
                    txtDate.Text + " " + txtTime.Text, drpSection.SelectedValue, 421200000000070,
                    Tools.StaffID, Tools.userHipo});

            //DataSet ds = Hipocrate.DB.DBConnection.GetData("Presentation_Save",
            //    new string[] { 
            //        "intCodeID", "strRefID", "strPacID", "strInsurer", "strInsuranceNo", 
            //        "strDate", "strSectionID", "strDoctorID", "strSenderTypeID",  "strSenderName",
            //        "strTransportTypeID", "strTransportNumber", "strTransportDoctor", "strTransportFile", "strPresReason",
            //        "strObs", "UserID", "UserLogin", "blnEmergency", "strIsInitial", 
            //        "ValidatedByID", "strMedicID", "InsurerChartID", "InsurerTypeID", "InsurerCategID",
            //        "PacientStudiesID", "ProfessionID", "CitizenshipTypeID", "CitizenshipID", "InsuranceTypeID",
            //        "strSenderSerie", "strSenderTicket", "strSenderDate", "strSenderContract", "PersType",
            //        "SenderSpecName", "strSenderMedicID"},
            //    new object[] { 
            //        Convert.ToInt64(presentationID), txtNrRegistru.Text, Convert.ToInt64(pacientID), Convert.ToInt64(asiguratDrp.SelectedValue), txtNrAsig.Text, 
            //        txtDate.Text + " " + txtTime.Text, drpSection.SelectedValue, Convert.ToInt64(drpMedic.SelectedValue), Convert.ToInt64(drpTipTrimitere.SelectedValue),txtParafa.Text,
            //        Convert.ToInt64(drpTipVenire.SelectedValue), txtNrVehicul.Text, txtMedicAmb.Text, txtFisaAmb.Text, txtMotivPrez.Text,
            //        txtAlteObsv.Text, Convert.ToInt64(Tools.GetUserID(Tools.userHipo, "")), Tools.userHipo, 1, 1, 
            //        Convert.ToInt64(Tools.GetUserID(Tools.userHipo, "")), Convert.ToInt64(drpMedic.SelectedValue), Convert.ToInt64(statutDrp.SelectedValue), Convert.ToInt64(tipAsiguratDrp.Text), Convert.ToInt64(catAsiguareDrp.SelectedValue),
            //        Convert.ToInt64(levelStudiesDrp.SelectedValue), Convert.ToInt64(ocupationDrp.SelectedValue), Convert.ToInt64(citizenshipTypeDrp.SelectedValue), Convert.ToInt64(citizenshipTypeDrp.SelectedValue), Convert.ToInt32(tipAsiguratDrp.SelectedValue),
            //        txtBiletTrimitere.Text, txtNrBilet.Text, Tools.GetDateInEnglishFormat(txtDataBilet.Text), txtContract.Text, Convert.ToInt64(tipAsigurareDrp.SelectedValue),
            //        txtSpecialitate.Text, Convert.ToInt64(txtParafa.Text)});

            this.SetMessage("Saved.", false);
        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        try
        {

        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }

    protected void btnValidate_Click(object sender, EventArgs e)
    {
        try
        {

        }
        catch (Exception ex)
        {
            this.SetMessage(ex.Message, true);
        }
    }
}
